/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service.inventory.impl;

import dao.inventory.PrincipalDao;
import java.util.List;
import model.inventory.Principal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import service.inventory.PrincipalService;

/**
 *
 * @author jay
 */
@Service("principalService")
@Transactional(readOnly=true)
public class PrincipalServiceImpl implements PrincipalService {
   
    @Autowired private PrincipalDao principalDao;

    @Transactional(readOnly=false)
    @Override
    public boolean save(Principal data) {
        return principalDao.save(data);
    }

    @Transactional(readOnly=false)
    @Override
    public boolean delete(Principal data) {
        return principalDao.delete(data);
    }

    @Override
    public Principal getPrincipal(int id) {
        return principalDao.getById(id);
    }

    @Override
    public List<Principal> getPrincipal() {
        return principalDao.getAll();
    }

    @Override
    public List<Principal> getPrincipal(int start, int num) {
        return principalDao.getAll(start, num);
    }

    @Override
    public List<Principal> getPrincipal(int start, int num, String params, String orderBy) {
        return principalDao.getAll(start, num, params, orderBy);
    }

    @Override
    public Principal getPrincipal(String kode) {
        return principalDao.getByKode("kode", kode);
    }
    
}
